package com.caseeye.base
import scala.reflect.BeanProperty

trait Versioning {

    @BeanProperty
    var version = 0

    def versionUp : Unit = version = version + 1

    def olderThan(that : Versioning) : Boolean = this.version < that.version

    def youngerThan(that : Versioning) : Boolean = this.version > that.version

    def sameAge(that : Versioning) : Boolean = this.version == that.version

    def youngerOrSame(that : Versioning) : Boolean = !olderThan(that)

    def olderOrSame(that : Versioning) : Boolean = !youngerThan(that)

}